﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="RawMaterialOrderHistory.aspx.cs" Inherits="XYZ_Inventory.RawMaterialOrderHistory" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="Styles/SearchBox.css" rel="stylesheet" type="text/css"/>
    <link href="Styles/GridView.css" rel="stylesheet" type="text/css"/>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h2>
        Past raw material orders</h2>
    <br />
<div class="searchBoxContainer">
    <asp:TextBox ID="txtSearch" CssClass="searchBox" runat="server" placeholder="Search by Order ID"></asp:TextBox>
    <asp:ImageButton ID="ImageButton1" runat="server" AlternateText="Search" ImageUrl="~/Images/magnifying_glass_icon.png"/>
</div>
    <br />
    <br />
    <asp:GridView ID="GridView1" CssClass="gridView" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ID" DataSourceID="RawMaterialOrderSource"
        ForeColor="#333333" GridLines="None">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
                SortExpression="ID" >
            <ItemStyle HorizontalAlign="Right" />
            </asp:BoundField>
            <asp:BoundField DataField="OrderDate" HeaderText="Order Date" 
                SortExpression="OrderDate" DataFormatString="{0:d}" />
            <asp:BoundField DataField="DeliveryDate" HeaderText="Delivery Date" 
                SortExpression="DeliveryDate" DataFormatString="{0:d}" />
            <asp:BoundField DataField="Quantity" HeaderText="Quantity" 
                SortExpression="Quantity" >
            <ItemStyle HorizontalAlign="Right" />
            </asp:BoundField>
            <asp:BoundField DataField="SupplierID" HeaderText="Supplier ID" SortExpression="SupplierID" />
            <asp:BoundField DataField="RawMaterialID" HeaderText="Raw Material ID" SortExpression="RawMaterialID" />
            <asp:CommandField HeaderText="Highlight" ShowSelectButton="True" />
        </Columns>
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#E9E7E2" />
        <SortedAscendingHeaderStyle BackColor="#506C8C" />
        <SortedDescendingCellStyle BackColor="#FFFDF8" />
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
    </asp:GridView>
    <asp:EntityDataSource ID="RawMaterialOrderSource" runat="server" ConnectionString="name=XYZDBContext"
        DefaultContainerName="XYZDBContext" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="RawMaterialOrders" EntityTypeFilter="RawMaterialOrder"
        OrderBy="it.ID DESC" Where="(it.ID = @ID OR @ID is NULL) AND it.Status == 'Delivered'">
        <WhereParameters>
            <asp:ControlParameter ControlID="txtSearch" DbType="Int32" Name="ID" PropertyName="Text" />
        </WhereParameters>
    </asp:EntityDataSource>
</asp:Content>
